package com.example.myapplication;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class ContactActivity extends AppCompatActivity {

    private ImageView avatarImageView;
    private TextView nameTextView, phoneTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_contact);

        avatarImageView = findViewById(R.id.imageViewDetail);
        nameTextView = findViewById(R.id.textViewName);
        phoneTextView = findViewById(R.id.textViewPhone);

        Intent intent = getIntent();
        int avatar = intent.getIntExtra("avatar", 0);
        String name = intent.getStringExtra("name");
        String phone = intent.getStringExtra("phone");

        avatarImageView.setImageResource(avatar);
        nameTextView.setText("姓名: " + name);
        phoneTextView.setText("电话: " + phone);
    }
}

